/*
 * @Author: lijing
 * @e-mail: 1413979079@qq.com
 * @LastEditors: lijing
 * @Date: 2020-05-03 10:12:22
 * @LastEditTime: 2020-06-23 11:44:50
 * @FilePath: \client\src\model\Timeline.ts
 * @Description: 时间线
 */

class Image {
  public id: number;
  public url: string;
  public title: string;
  public content: string;
  public static create(_image: any): Image {
    const image = new Image();
    image.id = _image.id;
    image.url = _image.url;
    image.title = _image.title;
    image.content = `${_image.user_info.name}上传于${_image.created_at}`;
    return image;
  }
}
class TimeItem {
  public date: string;
  public images: Image[] = [];
  public static create(item: any): TimeItem {
    const line = new TimeItem();
    line.date = item.date;
    for (const i of item.images) {
      line.images.push(Image.create(i));
    }
    return line;
  }
}

export default TimeItem;
